package ar.edu.utn.frsf.cidisi.ginet.generation.pnml2wscdl.elementstemplate;

import org.eclipse.emf.common.util.EList;
import org.pnml.tools.epnk.pnmlcoremodel.Page;
import org.w3._2005._10.cdl.CdlFactory;
import org.w3._2005._10.cdl.TChoice;
import org.w3._2005._10.cdl.TChoreography;
import org.w3._2005._10.cdl.TWorkunit;

public class XorWSCDL extends WSCDLStructure{
	
	public XorWSCDL(Page page, TChoreography choreography){
		this.page = page;
		this.choreography = choreography;
	}
	
	public TChoice createWSCDLElement(){
		EList<Page> pages1 = this.getPages(page);
		
		TChoice choice = CdlFactory.eINSTANCE.createTChoice();
		for(int i = 0; i < pages1.size(); i++){

			TWorkunit workunit = CdlFactory.eINSTANCE.createTWorkunit();
			workunit.setName("xor"+i);
			this.addTo(workunit, this.createPackageWscdl(pages1.get(i), this.choreography));
			choice.getWorkunit().add(workunit);
		}
		return choice;		
	}

}
